﻿CREATE PROCEDURE [dbo].[TempArticleSales_SelectCategoryMargins]
AS
	select c.Name, SUM(s.GM) / SUM(s.Sales) as Margin
	from ArticleSales s
	inner join Articles a on a.Id = s.ArticleId
	inner join Categories c on c.Id = a.CategoryId
	group by c.Name
RETURN 0